﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace QuanLyThuoc
{
    class KhachHang
    {
        string maKH;
        string hoTen;
        string diaChi;
        string soDT;

        public string MaKH
        {
            get { return maKH; }
            set { maKH = value; }
        }
        public string HoTen
        {
            get { return hoTen; }
            set { hoTen = value; }
        }
        public string DiaChi
        {
            get { return diaChi; }
            set { diaChi = value; }
        }
        public string SoDT
        {
            get { return soDT; }
            set { soDT = value; }
        }

        public KhachHang()
        { }

        public KhachHang(string maKH, string hoTen, string diaChi, string soDT)
        {
            this.maKH = maKH;
            this.hoTen = hoTen;
            this.diaChi = diaChi;
            this.soDT = soDT;
        }

        public void NhapKH()
        {
            Console.Write("\nNhap ma khach hang: ");
            maKH = Console.ReadLine();
            Console.Write("Nhap ho ten khach hang: ");
            hoTen = Console.ReadLine();
            Console.Write("Nhap dia chi: ");
            diaChi = Console.ReadLine();
            Console.Write("Nhap so dien thoai: ");
            soDT = Console.ReadLine();
        }

        public void XuatKH()
        {
            Console.Write("\n\t" + maKH.PadRight(10) + hoTen.PadRight(8) + diaChi.PadRight(15) + soDT);
        }

        public void ghiFile()
        {
            FileStream file = new FileStream("DSKhachHang.txt", FileMode.Append);
            BinaryWriter br = new BinaryWriter(file);
            br.Write(maKH);
            br.Write(hoTen);
            br.Write(diaChi);
            br.Write(soDT);
            br.Close();
            file.Close();
        }
    }
}
